﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Inovout
{
    public static class DateTimeExtension
    {
        public static long ToTimestamp(this DateTime datetime, DateTime? baseDateTime=null)
        {
            if (!baseDateTime.HasValue)
            {
                baseDateTime = new DateTime(1970, 1, 1);
            }
            return Decimal.ToInt64(Decimal.Divide(datetime.Ticks - baseDateTime.Value.Ticks, 10000));
        }
    }
}
